Many modern electronic devices, e.g. embedded devices, are controlled by software stored in flash memory. Flash memory is a type of memory that is frequently used in electronic devices, because it allows multiple rewrites. However, the write operations are limited to entire memory sectors, so-called pages, at a time. A typical page size of current flash memories is 64 kbyte.
When the software stored in a flash memory of an electronic device is updated, e.g. in order to add new features to the software and/or to correct errors in the current version of the software, some or all of the memory sectors of the flash memory are re-written/re-programmed or “re-flashed”. In general, it is desirable to minimize the number of flash pages that are re-written during a software update, in order to minimize the time and energy consumption required for installing the software update.
In particular, an application where update times are of great concern is the over-the-air (OTA) update of mobile terminals, e.g. the update of the firmware of the mobile terminal, a so-called Firmware-Over-The-Air (FOTA) update.
In order to provide resource-efficient update mechanisms, it is known to distribute incremental updates, i.e. to distribute only modifications to the current image to the target device, rather than the entire updated image. The modifications are generally referred to as delta-files. Typically, in such systems, an update agent running on the mobile terminal applies the received modifications to the current image which is thereby transformed to the updated version. It is generally desirable to reduce the size of the delta-files, in order to reduce the required loading/transmission bandwidth when sending the delta file via a communications channel and/or to reduce the processing time as well as storage requirements during the loading process in the target device.
Furthermore, it is generally desirable to reduce the amount of storage capacity and computational resources required in the mobile terminal in order to perform the software update.
It is further a general problem of such update systems that the terminal may not be functional during the update process. Hence, it is desirable to reduce the time required for re-flashing the memory and, thus, the downtime of the system.
For the purpose of the present description, the storage medium may have stored thereon one or more software modules that may be updated simultaneously or individually, e.g. different components of a larger software system and/or different individual software applications. The part of the binary memory content that corresponds to a certain software module will also be referred to as a memory image module.
In known delta update systems, information on how the software modules are placed in memory of the target device is typically available to the delta file generation tool. In particular, the delta file generation tool typically assumes that the start address of the memory image module to be updated is known and fixed, as is the case when the memory image comprises a single fixed image module that is always located at the same start address. However, a particular problem arises when the storage memory contains modules that may be located at different start addresses in the memory of each target device, such that the delta file generation tool does not know the actual start address of that module.
In particular, in such situations the exact binary image of the currently installed software module is not known to the off-line tools that generate the update package, and the images of a single version of a software module on different target devices are likely to be different. Furthermore, the location at which the new image will be loaded is not necessarily the same as that of the installed one, since e.g. space requirements may force the target device to select a different location.
Hence, the binary image of such a software module is completely determined only after being loaded in memory. Typically such modules are received by the target device in a relocatable version, e.g. in object code format that includes symbolic/unresolved references to memory addresses. For the purpose of the present description such modules will also be referred to as load modules. The symbolic references in a load module are resolved by the target device during the load process. Different symbolic references may require different resolutions, e.g. absolute references are resolved differently from relative references. Consequently, a load module has so-called relocation instructions associated with it that instruct the resolution process how to calculate actual memory address for respective symbolic references.
U.S. Pat. No. 6,230,316 discloses a method for incrementally updating files on a desktop computer system. In certain situations, it is not possible or not desirable to load an executable file to its originally intended location. The start address of the executable code is then changed, a process that is called rebasing. Rebasing is done on the target system after the software has been installed on the computer, which makes the exact content of the executable file unknown to the off-line tools that prepare the delta file. In particular, an executable file of a desktop system is typically stored in secondary memory, typically a hard disk, and part of the file is loaded from the secondary memory to a primary memory, typically a Random Access Memory (RAM), before it is executed. The part of the file that is not copied to the primary memory contains relocation information which lists references that are location dependent. The relocation information is utilized when rebasing the file. The relocation information can also be used for reverting the process of rebasing, which results in a canonical form that may be known to the off-line tools. The above prior art method discloses a method that generates a delta file between canonical forms of the current and the updated file, i.e. a form that has been rebased to a predetermined base address. On the target system, the installed version is brought in the same canonical form before the delta file is applied and the updated version is generated which may subsequently be rebased to a new base address.
Even though the above prior art method provides a method for incrementally updating rebased files on a desktop computer system, it remains a problem to provide an incremental update system that solves the above general problem and is suitable for portable devices controlled by embedded software, such as mobile terminals.
In particular, in contrast to a desktop system, a binary image used in an embedded system is usually executed “in place”, i.e. it is stored in persistent memory and executed from the same memory. Application of the above prior art method to an embedded system would require the relocation information to be stored in the target device in addition to the executable code. However, the size of the relocation information may be significant, possibly even in the same order as the memory image itself. The cost of the increased memory footprint is a disadvantage for mass-market products.